<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>修改管理员</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="${pageContext.request.contextPath }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath }/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/style.css?v=4.1.0" rel="stylesheet">
    <script src="${pageContext.request.contextPath }/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath }/js/bootstrap.min.js?v=3.3.6"></script>
    
    <!-- 自定义js -->
    <script src="${pageContext.request.contextPath }/js/content.js?v=1.0.0"></script>
    <!-- jQuery Validation plugin javascript-->
    <script src="${pageContext.request.contextPath }/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/plugins/layer/layer.min.js"></script>
    
	<style>
		input,select{
			 width:168px;
			 height:25px;
			 border:1px solid #ccc;
			 margin-left:24px;
		}
		.label-text{
			width:80px;
			text-align:right;
		}
	</style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-6">
                <div class="social-feed-box">
                    <div class="social-footer">
						<form name = "form1" id = "update_ar"  enctype='multipart/form-data'>
							<input type = "text" name = "targetId" id = "targetId" value = "${ea.targetId }"/><br/><br/>
							<input type = "text" name = "id" id = "id" value = "${ea.id }"/><br/><br/>
							<label class="label-text">识别图名称：</label>
								<input type = "text" name = "name" value = "${ea.name }"  placeholder="输入姓名，不超过20字" maxlength="20" ><br/><br/>
							<label  class="label-text">识别图：</label>
								<img src='${ea.trackingImage }'/><br/><br/>
								<input type='file' name='imageUrl'>
							<label  class="label-text">视频：</label>
								<input type='file' name='metas'>
							<label class="label-text">跳转链接：</label>
								<input type = "text" name = "meta" id = "meta" value = "${ea.meta }"/><br/><br/>
							<label class="label-text">宽度：</label>
								<input type = "text" name = "size" id = "size" value = "${ea.size }"/><br/><br/>
							<label class="label-text">状态：</label>
								<input type="radio" name="active" value='1' checked/><label>启用</label>  
					            <input type="radio" name="active" value="0"/><label>禁用</label> 
					            <br/><br/>
							<label class="btn btn-primary" onclick = "updateEasyAr()">保存</label>
					    </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

</body>

    
    <script type="text/javascript">
    
 	// 手机号码验证  
    jQuery.validator.addMethod("isMobile", function(value, element) {
        var length = value.length;
        var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
        return this.optional(element) || (length == 11 && mobile.test(value));
    }, "请正确填写您的手机号码");
 
 	function cancel(){
 		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);
 	}
      
	//修改或修改
	function updateEasyAr(){	
		alert("修改"); 
		var formData = new FormData($( "#update_ar" )[0]);  
		$.ajax({
			processData: false,
			contentType: false,
    		url:"${pageContext.request.contextPath }/admin/ar/update",
    		data:formData,
    		type:"post",
    		success:function(data){
    			alert(data);
    			if(data == 'success'){
					layer.msg("修改成功",{icon:1});
					setTimeout('cancel()',1000);
    			}else {
					layer.msg("系统错误，修改失败，请重试",{icon:0});
    			}
    		}
    	});
	}
	</script>
</html>
